import axios from 'axios'

export function getAddressApi() {
    const jwt = localStorage.getItem("token");
    return axios.get("/api/order/getAddress", {
        headers: {
            'token': jwt
        }
    })
}


export function saveOrder(data) {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/order/add", {
        totalAmount: data.totalAmount,
        totalCount:  data.totalCount,
        snapAddress: data.snapAddress,
        tel:         data.tel,
        spuInfo:     data.spuInfo
    }, {
        headers: {
            'Content-Type': 'application/json',
            'token': jwt
        }
    })
}


export function getOrderListApi(data) {
    const jwt = localStorage.getItem("token");
    return axios.post("/api/order/list", {
        start:  data.start,
        count:  data.count
    }, {
        headers: {
            'Content-Type': 'application/json',
            'token': jwt
        }
    })
}